/**********************************************************

     文件名称: com_inventory.c

     项目功能: 盘点商品库存 

     作者: 佳奇

     邮箱: 1374804492@qq.com 

     创建时间: Sat 27 Aug 2022 10:15:42 AM CST

**********************************************************/


#include <stdio.h>
#include <stdlib.h>
#include "sup_mgr.h"


//	盘点商品库存
void com_inven(com_list* demo)
{
	int com_id;
	com_list* s1 = demo->next;
	demo = demo->next;

	system("clear");
	printf("\n********查看商品库存模式********\n");
	
	while(1)
	{
		printf("\n请输入您要查看库存的商品条码(编号):");
		while(!geshipanduan(scanf("%d", &com_id)));
		c_buffer();

		while(demo != NULL && demo->data->barcode != com_id)	demo = demo->next;
		
		if(demo == NULL)
		{
			printf("\n未查询到编号为:%d的商品库存信息\n", com_id);
			printf("\n是否继续查询(y/n):");
			if(getchar() == 'y')
			{
				system("clear");
				c_buffer();
				demo = s1;
				continue;
			}
			else return;
		}

		printf("\n商品编号为:%d\n\n商品名称:%s\n\n总数量:%d\n\n剩余数量:%d\n\n", demo->data->barcode, demo->data->com_name, demo->data->num, demo->data->allow);	
		printf("*****************\n");
		printf("\n是否继续查询(y/n):");
		if(getchar() == 'y')
		{
			system("clear");
			c_buffer();
			demo = s1;
			continue;
		}else break;
	}
}

